const HtmlWebpackPlugin = require("html-webpack-plugin");
const MonacoEditorWebpackPlugin = require("monaco-editor-webpack-plugin");
module.exports = {
    mode: "development",
    entry: './src/index.js',
    output: {
        filename: 'main.js',
    },
    devServer: {
        proxy: [
            {
                context: ['/compile'],
                target: 'http://localhost:3000',
            }
        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: './public/index.html',
        }),
        new MonacoEditorWebpackPlugin({
            languages: ['javascript', 'typescript', 'css', 'html'],
            features: ['smartSelect', 'snippets', 'suggest', 'hover']
        }),
    ],
    module: {
        rules: [
            {
                test: /\.css$/,
                use: ['style-loader', 'css-loader'],
            },
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: ['@babel/preset-env', "@babel/preset-react"],
                    },
                },
            },
        ],
    },
}